package shell.config
{
	import com.hobbit.analyze.AssetsManager;
	import com.hobbit.analyze.base.Config;
	import com.hobbit.analyze.base.LoadItem;
	import com.hobbit.analyze.core.IConfigManager;
	
	import shell.config.parser.SkillParser;

	/**
	 * 游戏内配置表管理器 
	 * @author 晓晔
	 * 
	 */
	public class ConfigManager implements IConfigManager
	{
		public function ConfigManager()
		{
			if(_instance == null)
			{
				_instance = this;
			}else
			{
				throw new Error("实例化单例类出错---> ConfigManager");
			}
		}
		
		private static var _instance:ConfigManager;
		public static function getInstance():ConfigManager
		{
			if(_instance == null)
			{
				_instance = new ConfigManager();
			}
			return _instance;
		}
		
		/**
		 * 解析数据表
		 */
		public function parserDataXML():void
		{
			skillParser.parser(getXML("skill"));
			
		}
		private function getXML($key:String,$type:String = LoadItem.TYPE_XML):XML
		{
			return XML(AssetsManager.getInstance().getSynPreloadRes($key,"",$type));
		}
		
		
		
		
		//======
		
		public function get skillParser():SkillParser
		{
			if(!_skillParser)_skillParser = new SkillParser();
			return _skillParser;
		}

		//=======
		/**
		 * 技能配置解析器 
		 */
		private var _skillParser:SkillParser;
		
	}
}